package com.yunli.mall.service;

import java.lang.reflect.Array;
import java.util.*;

/**
 * @author yaolonglong
 * @date 2020/9/6 15:17
 */
public class LruTest {
    public static void main(String[] args) {
        Set<Character> mySet = Collections.newSetFromMap(new LinkedHashMap<Character, Boolean>(){
            @Override
            protected boolean removeEldestEntry(Map.Entry<Character, Boolean> eldest) {
                return size() > 2;
            }
        });
        String s = "abcdefghijkl";
        for (int i = 0; i < s.length(); i++) {
            mySet.add(s.charAt(i));
        }
        System.out.println(mySet);
    }
}
